/* Copyright Thanh-Trung Pham, JAIST, 2013 */
package jp.ac.jaist.simulation;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author Thanh-Trung Pham
 */
public class RMPIReliabilitySimulationStatistics {

    private Map<Set<String>, Integer> m_oSimulationData;
    private int m_iTotalNumberOfRuns = 0;

    /**
     * The constructor.
     */
    public RMPIReliabilitySimulationStatistics() {
        m_oSimulationData = new HashMap<Set<String>, Integer>();
    }

    /**
     * Increase a counter for an output.
     *
     * @param output the output.
     */
    public void increaseCounter(Set<String> output) {
        m_iTotalNumberOfRuns++;

        if (m_oSimulationData.containsKey(output)) {
            m_oSimulationData.put(output, m_oSimulationData.get(output).intValue() + 1);
        } else {
            m_oSimulationData.put(output, 1);
        }
    }

    /**
     * Get a counter for an input.
     *
     * @param output the output.
     * @return the counter for the input.
     */
    public Integer getCounter(Set<String> output) {
        if (m_oSimulationData.containsKey(output)) {
            return m_oSimulationData.get(output);
        } else {
            return new Integer(0);
        }
    }

    /**
     * Get the total number of runs.
     * @return the total number of runs.
     */
    public int getToTalNumberOfRuns(){
        return m_iTotalNumberOfRuns;
    }
}
